package net.oschina.archx.spring.web;

import net.oschina.archx.spring.model.JsonModel;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

/**
 * UploadController
 *
 * @author Archx[archx@foxmail.com]
 * @date 2016/2/25 0025
 */
@Controller
@RequestMapping("/upload")
public class UploadController {

    @RequestMapping
    @ResponseBody
    public String index(@RequestParam("file") MultipartFile file) {
        if (file != null) {
            return "文件名: " + file.getName() + ", 大小: " + file.getSize() + ", 原始文件名: " + file.getOriginalFilename();
        }
        return null;
    }
}
